package cn.limc.ohoscharts.demo.slice;

import cn.limc.ohoscharts.demo.common.BaseAbility;
import cn.limc.ohoscharts.demo.ResourceTable;
import cn.limc.ohoscharts.axis.Axis;
import cn.limc.ohoscharts.entity.IStickEntity;
import cn.limc.ohoscharts.entity.ListChartData;
import cn.limc.ohoscharts.event.IZoomable;
import cn.limc.ohoscharts.view.ColoredSlipStickChart;
import ohos.aafwk.content.Intent;
import ohos.agp.colors.RgbColor;
import ohos.agp.components.element.ShapeElement;
import ohos.agp.utils.Color;

public class ColoredSlipStickChartAbility extends BaseAbility {

  ColoredSlipStickChart coloredslipstickchart;

  @Override
  protected void onStart(Intent intent) {
    super.onStart(intent);
    setUIContent(ResourceTable.Layout_ability_colored_slip_stick_chart);
    initColoredSlipStickChart();

  }


//    @Override
//    public boolean onCreateOptionsMenu(Menu menu) {
//        // Inflate the menu; this adds items to the action bar if it is present.
//        getMenuInflater().inflate(R.menu.colored_slip_stick_chart, menu);
//        return true;
//    }

  private void initColoredSlipStickChart() {
    this.coloredslipstickchart =
            (ColoredSlipStickChart) findComponentById(ResourceTable.Id_coloredslipstickchart);

    coloredslipstickchart.setAxisXColor(Color.LTGRAY.getValue());
    coloredslipstickchart.setAxisYColor(Color.LTGRAY.getValue());
    coloredslipstickchart.setLatitudeColor(Color.GRAY.getValue());
    coloredslipstickchart.setLongitudeColor(Color.GRAY.getValue());
    coloredslipstickchart.setBorderColor(Color.LTGRAY.getValue());
    coloredslipstickchart.setLongitudeFontColor(Color.WHITE.getValue());
    coloredslipstickchart.setLatitudeFontColor(Color.WHITE.getValue());

    // // 最大纬线数
    // coloredslipstickchart.setLatitudeNum(2);
    // // 最大经线数
    // coloredslipstickchart.setLongitudeNum(3);
    // 最大价格
    coloredslipstickchart.setMaxValue(600000);
    // 最小价格
    coloredslipstickchart.setMinValue(100);

    coloredslipstickchart.setDisplayFrom(10);

    coloredslipstickchart.setDisplayNumber(30);

    coloredslipstickchart.setMinDisplayNumber(5);

    coloredslipstickchart.setZoomBaseLine(IZoomable.ZOOM_BASE_LINE_CENTER);

    coloredslipstickchart.setDisplayLongitudeTitle(true);
    coloredslipstickchart.setDisplayLatitudeTitle(true);
    coloredslipstickchart.setDisplayLatitude(true);
    coloredslipstickchart.setDisplayLongitude(true);
    ShapeElement background = new ShapeElement();
    background.setRgbColor(new RgbColor(00, 00, 00));
    coloredslipstickchart.setBackground(background);

    coloredslipstickchart.setDataQuadrantPaddingTop(5);
    coloredslipstickchart.setDataQuadrantPaddingBottom(5);
    coloredslipstickchart.setDataQuadrantPaddingLeft(5);
    coloredslipstickchart.setDataQuadrantPaddingRight(5);
    // coloredslipstickchart.setAxisYTitleQuadrantWidth(50);
    // coloredslipstickchart.setAxisXTitleQuadrantHeight(20);
    coloredslipstickchart.setAxisXPosition(Axis.AXIS_X_POSITION_BOTTOM);
    coloredslipstickchart.setAxisYPosition(Axis.AXIS_Y_POSITION_RIGHT);

    // 为chart1增加均线
    coloredslipstickchart.setStickData(new ListChartData<IStickEntity>(volc));
  }


}
